<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>卡片翻转效果</title>
</head>

<body>
    <div class="card">
        <img class="face" src="https://picsum.photos/200/300" />
        <p class="back">
            <span>背面背景</span>
        </p>
    </div>
</body>
<style>
    body{
        display: flex;
        justify-content: center;
    }
    .card{
        position: relative;
    }
    .face{
        position: absolute;
    }
    .back{
        position: absolute;
    }
    /* 下面的css实现翻转 */
    .back {
        transform: rotateY(180deg);
        backface-visibility: hidden;
        transition: 0.5s;
    }

    .card:hover .back {
        transform: rotateY(0);
    }

    .card:hover .face {
        transform: rotateY(-180deg);
    }

    .face {
        transition: 0.5s;
        backface-visibility: hidden;
    }

    .card {
        /* 设置景深 ，营造3D效果 */
        perspective: 500px;
    }
</style>

</html>